﻿Public Class frmKhachHang
    Dim connect As New connect()
    Public Sub ganID(ByVal maKH As String)
        Me.txtMaKH.Text = maKH
    End Sub

    Private Sub frmKhachHangvb_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        LoadThongtin()
    End Sub
    Private Sub LoadThongtin()
        Dim i As Integer
        Dim dt As DataTable
        dt = connect.GetData("select HOTEN,GIOITINH,DIENTHOAI,EMAIL,DIACHI from KHACHHANG where MAKH='" + txtMaKH.Text() + "'")
        For i = 0 To dt.Rows.Count() - 1 Step 1
            txtTenKH.Text = dt.Rows(i)(0).ToString().Trim()
            Dim gioiTinh As Boolean = dt.Rows(i)(1)
            If (gioiTinh) Then
                txtGioiTinh.Text = "Nam"
            Else
                txtGioiTinh.Text = "Nữ"
            End If
            txtDienThoai.Text = dt.Rows(i)(2).ToString().Trim()
            txtEmail.Text = dt.Rows(i)(3).ToString().Trim()
            txtDiaChi.Text = dt.Rows(i)(4).ToString().Trim()
        Next

    End Sub

    Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub frmKhachHang_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If (e.KeyCode = Keys.Enter) Then
            btnExit.PerformClick()
        End If
    End Sub

End Class